<?php
namespace DaQiang\Controller;

use Think\Controller;

Class MenuController extends Controller
{


    public function index()
    {

        $options = array(
            'appid' => C("appid"), //填写你设定的key
            'appsecret' => C("appsecret"),
        );
        $MenuData = array(
            'button' => array(
                0 => array(
                    'name' => '最重庆！',
                    'sub_button' => array(
                       /* 0 => array(
                            'type' => 'view',
                            'name' => '大重庆好吃的！',
                            'url' => 'http://weixin.weirongm.com/DaChongQing/News/GetCode/column/1',
                        ),
                        1 => array(
                            'type' => 'view',
                            'name' => '大重庆好耍的！',
                            'url' => 'http://weixin.weirongm.com/DaChongQing/News/GetCode/column/3',
                        ),*/
                        0 => array(
                            'type' => 'view',
                            'name' => '大重庆搞笑的！',
                            'url' => 'http://weixin.weirongm.com/DaChongQing/News/GetCode/column/10',
                        ),
                        1 => array(
                            'type' => 'view',
                            'name' => '大重庆最热话题！！！',
                            'url' => 'http://weixin.weirongm.com/DaChongQing/News/GetCode/column/4',
                        )
                        /*4 => array(
                            "type" => "view",
                            "name" => "大重庆美女帅锅！",
                            "url" => "http://weixin.weirongm.com/DaChongQing/News/GetCode/column/20",
                        )*/


                    ),
                ),
                1 => array(
                    'name' => '抢红包！',
                    'sub_button' => array(
                        0 => array(
                            "type" => "click",
                            "name" => "抢红包活动说明",
                            "key" => "b1"
                        ),

                        1 => array(
                            "type" => "click",
                            "name" => "推广排行榜",
                            "key" => "b2"
                        ),
                        2 => array(
                            "type" => "click",
                            "name" => "抢红包实时动态",
                            "key" => "b3"
                        ),
                        3 => array(
                            "type" => "view",
                            "name" => "我的推广二维码",
                            "url" => "http://weixin.weirongm.com/DaChongQing/Qrcode/code",
                        ),
                        4 => array(
                            "type" => "click",
                            "name" => "我要领红包！",
                            "key" => "b5"
                        )


                    ),
                ),
                2 => array(
                    'name' => '我的地盘！',
                    'sub_button' => array(
                        0 => array(
                            "type" => "click",
                            "name" => "天天来签到！",
                            "key" => "c1"
                        ),
                        1 => array(
                            "type" => "click",
                            "name" => "天天来抽奖！",
                            "key" => "c2"

                        ),
                        2 => array(
                            "type" => "click",
                            "name" => "来人！我有话说！",
                            "key" => "c3"

                        ),
                        3 => array(
                            "type" => "click",
                            "name" => "大渝币兑换中心",
                            "key" => "c4"

                        ),
                        4 => array(
                            "type" => "view",
                            "name" => "粉丝家园！",
                            "url" => "http://weixin.weirongm.com/DaChongQing/News/GetCode/column/19"

                        )


                    ),
                ),
            )
        );
        $wechat = new Wechat($options);
        $istrue = $wechat->createMenu($MenuData);

        if ($istrue) {
            echo "生成新菜单成功！";
        } else {
            echo "生成新菜单失败！";
        }
        dump($wechat->getMenu());
    }

}


?>